//: [Previous](@previous)

import Foundation
//import GeekTime_PageSources


var greeting = "Hello, playground"

// MARK: - 动态规划
var stairs = 7
Test_DynamicProgram.climbStairs(stairs)
Test_DynamicProgram.climbStairs2(&stairs)



// MARK: - 数组相关
var nums1 = [1,2,3,9]
var nums2 = [2,5,6,7,8,11]
// 合并两个有序数组
Array_Practice.merge(&nums1, nums2)

// 把数组内的奇数排到前面
var sortArr = [1,2,4,5,8,7,3,10]
Array_Practice.sortArray_oddToFront(arr: &sortArr)

// 轮转数组
var rotateArr = [1,2,3,4,5]
Array_Practice.rotate3(&rotateArr, k: 2)


// MARK: - 数字相关
Test_Number.reverse(7894)


// MARK: - 字符串相关
// 字符串反转
String_Practice.reverseStrings("12345")
// 一个字符串中第一个只出现一次的字符
String_Practice.firstUniqChar("leetcode")
// 判断回文
String_Practice.isPalindrome("*^%@!abc#)1cba~!@")
String_Practice.isPalindrome2("*^%@!abc#)1cba~!@")

String_Practice.decodeString("3[a2[c]]")

// 判断是否为子序列
String_Practice.isSubsequence("abc", "ahbgdc")

// MARK: - 链表相关

// 链表反转
let list = NodeList()
    .appendToTail(1)
    .appendToTail(2)
    .appendToTail(3)
    .appendToTail(4)
    .appendToTail(5)
Test_NodeList.reverseList(list)

// 链表有环
let node1 = Node(1)
let node2 = Node(2)
let node3 = Node(3)
let node4 = Node(4)
let node5 = Node(5)

let nodeList = NodeList()
nodeList.appendNodeToTail(node1)
nodeList.appendNodeToTail(node2)
nodeList.appendNodeToTail(node3)
nodeList.appendNodeToTail(node4)
nodeList.appendNodeToTail(node5)
// 结环
node5.next = node2
// 检测是否有环
Test_NodeList.hasCycle(nodeList)


// 合并有序链表

